package ooday04;

public class Test1 {
    public static void main(String[] args) {
        Animal1[] animal1 = new Animal1[5];
        animal1[0] = new Dog1("小黑",1,"黑");
        animal1[1] = new Dog1("小白",2,"白");
        animal1[2] = new Chick1("坤坤",1,"棕");
        animal1[3] = new Chick1("ikun",2,"黄");
        animal1[4] = new Fish1("泡泡",1,"金");

        for (int i = 0;i< animal1.length;i++){
            System.out.println(animal1[i].name);
            animal1[i].eat();
            animal1[i].drink();
        }


        for (int i = 0;i< animal1.length;i++){
            if (animal1[i] instanceof Dog1){
                Dog1 dog1 =(Dog1)animal1[i];
                dog1.lookHome();
            }
        }


        for (int i = 0;i< animal1.length;i++){
            if (animal1[i] instanceof Chick1){
                Chick1 chick1 =(Chick1)animal1[i];
                chick1.layEgg();
            }
        }

        for (int i = 0;i< animal1.length;i++){
            if (animal1[i] instanceof Swim1){
                Swim1 swim1 =(Swim1) animal1[i];
                swim1.swim1();
            }
        }

        Master1 master1 = new Master1();
        Animal1 dog = new Dog1("小绿",2,"绿");
        Animal1 chick = new Chick1("只因",1,"黑白");
        Animal1 fish = new Fish1("丑丑",3,"深红");
        master1.feed(dog);
        master1.feed(chick);
        master1.feed(fish);


    }
}
